]>
Commit | Line | Data |
---|---|---|
2faffece P |
1 | IDENTIFICATION DIVISION |
2 | PROGRAM-ID Damped_Oscillator | |
3 | ||
4 | ENVIRONMENT DIVISION | |
5 | ENGINE Anabrid-THAT | |
6 | TIMEBASE 1ms | |
7 | REQUIRES COEFFICIENT 5 | |
8 | REQUIRES INTEGRATOR 2 | |
9 | REQUIRES INVERTER 1 | |
10 | REQUIRES SUMMER 2 | |
11 | ||
12 | DATA DIVISION | |
f25252dd | 13 | OUTPUT OUTPUT.U y |
2faffece P |
14 | ALIAS COEFFICIENT.1 InitialPosition |
15 | ALIAS COEFFICIENT.2 InitialSpeed | |
16 | ALIAS COEFFICIENT.3 SpringForce | |
17 | ALIAS COEFFICIENT.4 Damping # linear to speed | |
18 | ALIAS COEFFICIENT.5 Mass # 1 / mass | |
19 | ||
20 | PROGRAM DIVISION | |
21 | # Colors being used for wiring | |
22 | # - black: y0 | |
23 | # - blue: y0’ | |
24 | # - green: y0’’ | |
25 | # - yellow: y’’, y’ | |
26 | # - red: y | |
27 | -1 -> InitialPosition -> -y0 # -initial position of the mass | |
28 | -1 -> InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1 | |
6e8a1392 | 29 | +1, y0s’, y0s’ -> Summer -> y0’ |
2faffece | 30 | |
6e8a1392 P |
31 | y’’, IC:y0’ -> INTEGRATOR -> -y’ |
32 | -y’,IC:-y0 -> INTEGRATOR -> y | |
2faffece | 33 | y -> SpringForce -> S*y # springforce times displacement |
6e8a1392 | 34 | -y’ -> INVERTER -> y’ |
2faffece | 35 | y’ -> Damping -> D*y’ # damping times speed |
6e8a1392 | 36 | 10:S*y, 10:D*y’ -> SUMMER -> -(Dy’+Sy) |
2faffece P |
37 | -(Dy’+Sy) -> Mass -> -1/m*(Dy’+Sy)=y’’ |
38 | ||
39 | OPERATION DIVISION | |
40 | MODE REPEAT | |
41 | OP-TIME 57ms |